package com.lenovo.plm.tf.unit;

import java.rmi.RemoteException;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import wt.log4j.LogR;
import wt.method.RemoteMethodServer;
import wt.org.WTPrincipal;
import wt.session.SessionHelper;
import wt.util.WTException;

public class LoginTest {

	private static java.util.logging.Logger logger = LogR.getLogger(LoginTest.class.getName());
	
	@BeforeClass
	public static void initClass() throws RemoteException {
		
		logger.setLevel(Level.ALL);
        RemoteMethodServer rms = RemoteMethodServer.getDefault();
        rms.setUserName("dms");
        rms.setPassword("dms");
        logger.info("Start Time Info :"+rms.getInfo().startDate);
        logger.info("initial class");
	}
	
	@Before
	public void initMethod() {
		logger.info("initial method");
	}
	
	@Test
	public void testLogin() throws WTException {
		
        WTPrincipal wtUser = SessionHelper.manager.getPrincipal();
        logger.info("Login User: "+wtUser.getName());
		logger.info("executing method");
	}
	
	@After
	public void endMethod() {
		
		logger.info("end method");
	}
	
	@AfterClass
	public static void endClass() {
		
		logger.info("end class");
		
		logger.info("this is test");
	}
}
